---
id: property-field-injection
title: Property/Field Injection
---

Dependencies can be injected into properties or fields as well. To do so, annotate each property or field that represents a dependency with `[Inject]`.

```csharp
class ClassA
{
    [Inject]
    IServiceA serviceA { get; set; }
    
    [Inject]
    IServiceB serviceB;

    public ClassA()
    {
    }
}
```

Injection via properties or fields is a helpful alternative to [method injection](./method-injection).
